class Solution
{
public:
    int minimumOperationsToMakeKPeriodic(string word, int k)
    {
        int n = word.size();
        unordered_map<string, int> m;
        int maxCount = 0;
        for (int i = 0; i < n; i += k)
        {
            string s = word.substr(i, k);
            m[s]++;
            maxCount = max(maxCount, m[s]);
        }
        return n / k - maxCount;
    }
};